import React, { Component } from 'react';
import {
  Platform,
  StyleSheet,
  Text,
  View
} from 'react-native';

import HelloWorld from './components/HelloWorld'
import LifeCycle from './components/LifeCycle'
export default class Entry extends Component{
    constructor(props){
        super(props)
        this.state={
            remove:false
        }
    }
    render(){
        var view = this.state.remove?null:<LifeCycle />
        var showText = this.state.remove?'重新装在LifeCycle组件':'干掉LifeCycle组件';
        return (<View style={styles.container}>
                {view}
                    <Text style={styles.btnStyle} onPress={
                        ()=>{
                            this.setState({
                                remove:!this.state.remove
                            })
                        }
                    }>{showText}</Text>
        </View>)
    }
}


const styles = StyleSheet.create({
    container: {
        marginTop:50
    },
    btnStyle:{
        backgroundColor:'#f2e514',
        textAlign:'center',
        lineHeight:30
    }
})